explicit cast:显式类型转换(在编程中,开发者用明确的语法把一个值从一种数据类型转换为另一种数据类型,通常用于避免隐式转换带来的歧义或错误)。在不同语言里常见形式包括 C/C++ 的 (type)value、C# 的 (type)value、Java 的 (Type) value 等。
I used an explicit cast to convert the float to an int.
我用了显式类型转换,把浮点数转换成整数。
Without an explicit cast, the compiler warns that converting a large integer to a smaller type may lose data.
如果不进行显式类型转换,编译器会警告把大整数转换成更小的类型可能会丢失数据。
/ɪkˈsplɪsɪt kɑːst/
explicit 来自拉丁语 explicitus,含义与“清楚展开、明确说明”相关;cast 在此并非“投掷/演员”,而是计算机领域的用法,指“把(数据)塑造成另一种类型”。合起来 explicit cast 就是“需要明确写出来的类型转换”。
static_cast 等)。